|
|
|
|
|
|
|
The servername parameter is an LPWSTR (LP = Long pointer, W = Wide, STR = String). It's a pointer to a wide (Unicode) string. Since the function explicitly specifies a wide string, you can be pretty certain that there is a single entry point for the function instead of separate Unicode and ANSI entry points. This parameter can also be NULL to add the user to the local system. |
|
|
|
|
|
|
|
|
The level parameter is set to a value of 1, 2, or 3. If 1, the buf parameter points to a USER_LEVEL_1 structure; if 2, a USER_LEVEL_2 structure; and if 3, a USER_LEVEL_3 structure. These structures contain the information about the user that is being added. |
|
|
|
|
|
|
|
|
The buf parameter is a pointer to the appropriate structure. Why don't they use a specific type such as LPUSER_LEVEL_1? Because the parameter needs to point to any of the available structure types depending on the value of the level parameter. LPBYTE means pointer to a byte and is often used as a generic pointer type when a pointer has to refer to more than one type. |
|
|
|
|
|
|
|
|
The parm_err parameter is a pointer to a Long variable that is loaded with the index of the parameter in the structure that caused an errorthe position of that parameter in the structure. |
|
|
|
|
|
|
|
|
The function returns a long value. According to the documentation, the value is NERR_SUCCESS if the function succeeds. A search through the header files showed that NERR_SUCCESS is equal to 0. |
|
|
|
|
|
|
|
|
Figure P23-1:
The Win32 SDK Quick Info window |
|
|
|
|
|
|
|
|
I was almost ready to write the Visual Basic declaration. One question: What's the name of the DLL? I could have used the DumpInfo program (described in Tutorial 9, "Inside a DLL File: Exploring the DumpInfo Program," in Part III of this book) to search for the DLL that supports this function, but since I already had the Win32 SDK online reference open, I simply clicked on the QuickInfo button to receive summary information about the function, as shown in Figure P23-1. |
|
|
|
|
|
|
|
|
The key information is the import library, which in this case is |
|
|
|
|
|